Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
The @wry/trie package is a library for creating and manipulating trie data structures in JavaScript. A trie, also known as a prefix tree, is a type of search tree that is used to store a dynamic set or associative array where the keys are usually strings. It is particularly useful for tasks like autocomplete, spell checking, and prefix matching.
Creating a Trie
This feature allows you to create a new Trie instance and insert strings into it. You can then find all strings that start with a given prefix.
{"import { Trie } from '@wry/trie';
const trie = new Trie();
trie.insert('hello');
trie.insert('world');
trie.insert('help');
console.log(trie.find('hel')); // ['hello', 'help']
console.log(trie.find('world')); // ['world']"}
Checking for Existence
This feature allows you to check if a particular string exists in the trie.
{"import { Trie } from '@wry/trie';
const trie = new Trie();
trie.insert('hello');
trie.insert('world');
console.log(trie.has('hello')); // true
console.log(trie.has('bye')); // false"}
Removing Entries
This feature allows you to remove entries from the trie.
{"import { Trie } from '@wry/trie';
const trie = new Trie();
trie.insert('hello');
trie.insert('world');
trie.remove('hello');
console.log(trie.has('hello')); // false
console.log(trie.has('world')); // true"}
The trie-search package is another implementation of a trie data structure for JavaScript. It offers similar functionalities for adding and searching words in a trie. It also allows for customizing the key on which the trie is built and supports wildcard searches.
This package implements a ternary search trie, which is a type of trie that can have better performance for certain datasets or use cases. It is similar to @wry/trie in that it is used for storing strings and performing prefix searches, but the underlying data structure and performance characteristics may differ.
A trie data structure that holds
object keys weakly, yet can also hold non-object keys, unlike WeakMap
.
FAQs
https://en.wikipedia.org/wiki/Trie
The npm package @wry/trie receives a total of 4,552,536 weekly downloads. As such, @wry/trie popularity was classified as popular.
We found that @wry/trie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.